package cn.iocoder.yudao.module.school.dal.mysql.info;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.school.dal.dataobject.info.InfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.school.controller.admin.info.vo.*;

/**
 * 校园信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InfoMapper extends BaseMapperX<InfoDO> {

    default PageResult<InfoDO> selectPage(InfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InfoDO>()
                .likeIfPresent(InfoDO::getSchoolName, reqVO.getSchoolName())
                .eqIfPresent(InfoDO::getAddress, reqVO.getAddress())
                .eqIfPresent(InfoDO::getSchoolType, reqVO.getSchoolType())
                .eqIfPresent(InfoDO::getPhone, reqVO.getPhone())
                .eqIfPresent(InfoDO::getPrincipal, reqVO.getPrincipal())
                .eqIfPresent(InfoDO::getFoundingYear, reqVO.getFoundingYear())
                .eqIfPresent(InfoDO::getDescription, reqVO.getDescription())
                .eqIfPresent(InfoDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InfoDO::getLogoUrl, reqVO.getLogoUrl())
                .eqIfPresent(InfoDO::getLocation, reqVO.getLocation())
                .eqIfPresent(InfoDO::getArea, reqVO.getArea())
                .betweenIfPresent(InfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoDO::getId));
    }

}